package cn.xxstudy.visitshop.ui.activity.main.fragment.visit.viewmodel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import cn.xxstudy.visitshop.ui.activity.main.fragment.visit.model.VisitData
import kotlinx.coroutines.launch

/**
 * @author ：DELL on 2021/3/25 .
 * @packages ：cn.xxstudy.visitshop.ui.activity.main.fragment.visit.viewmodel .
 * TODO:
 */
class VisitViewModel : ViewModel() {
    val visitLiveData = MutableLiveData<ArrayList<VisitData>>()
    val failLiveData = MutableLiveData<String>()
    private val visitRepository = VisitRepository()

    fun visit(userId: String) {
        viewModelScope.launch {
            visitRepository.visitList(userId, visitLiveData, failLiveData)
        }
    }
}